﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tesseract;
using Tesseract.Interop;

namespace TesseractTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "pdf.png");
            Console.OutputEncoding = Encoding.UTF8;
            // 识别中文简体字
            using (var engine = new TesseractEngine(@"./tessdata", "chi_sim", EngineMode.Default))
            {
                using (var entity = engine.Process(bitmap))
                {
                    var str = entity.GetText();
                    Console.WriteLine(str);
                }
            }
            Console.ReadLine();
        }
    }
}
